Programming in Objective-C, Sixth Edition (Jason Arnold's Library) by Stephen G. Kochan

Programming in Objective-C, Sixth Edition (Jason Arnold's Library) by Stephen G. Kochan

Author:Stephen G. Kochan
Language: eng
Format: epub
Publisher: Addison-Wesley Professional
Published: 2014-09-02T04:00:00+00:00


* * *

// Program to generate the first 15 Fibonacci numbers

#import <Foundation/Foundation.h>

int main (int argc, char * argv[])

{

@autoreleasepool {

int Fibonacci[15], i;

Fibonacci[0] = 0; /* by definition */

Fibonacci[1] = 1; /* ditto */

for ( i = 2; i < 15; ++i )

Fibonacci[i] = Fibonacci[i-2] + Fibonacci[i-1];

for ( i = 0; i < 15; ++i )

NSLog (@"%i", Fibonacci[i]);

}

return 0;

}

* * *

Program 13.1 Output

* * *

0

1

1

2

3

5

8

13

21

34

55

89

144

233

377



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.